#pragma once

#include "SceneSubsystem.h"
#include "Render/Scene/CameraParameters.h"
#include "SceneCameraSubsystem.m.h"


class RCameraComponent;

//相机管理器
RCLASS(ExtraHeader="Scene/CameraComponent.h")
class WHENGINE_API RSceneCameraManager :public RSceneSubsystem
{
    ROBJECT

public:

    void RegisterComponent(TSharedObjectPtr<RCameraComponent> InComponent);
    void UnregisterComponent(TSharedObjectPtr<RCameraComponent> InComponent);

    //切换相机
    void ChangeTo(TSharedObjectPtr<RCameraComponent> InComponent);

    //获取由场景提供的相机参数
    SRawCameraParameters GetSceneCameraParameter();
protected:
    //当前正在起作用的相机组件，可能为空，因为场景中可能就没有相机组件
    RFIELD()
    TSharedObjectPtr<RCameraComponent> CurrentComponent;

    //所有注册的相机
    RFIELD()
    TVector<TSharedObjectPtr<RCameraComponent>> Cameras;
};